const HtmlWebpackPlugin = require('html-webpack-plugin')
const { CleanWebpackPlugin } = require('clean-webpack-plugin');


module.exports = {
    mode: 'development',
    devtool: "source-map",
    // entry:{
    //     index:'./src/index.js'
    // },
    output: {
        filename: "./scripts/[name].[chunkhash:5].js"
    },
    
    plugins: [
        new CleanWebpackPlugin(),
        new HtmlWebpackPlugin(),
    ],

    devServer:{
        port: 8000,
        open: true,
        proxy:{
            "/api":{
                target: "http://localhost:3000/",
                changeOrigin: true // 更改请求头中的host和origin
                // http://localhost:8080/get ==> https://open.duyiedu.com/api/get
            }
        },
        stats:{ // 输出内容配置
            modules: false
        }
    }
}